
package  main

import (
	"fmt"
	"sync"
	"time"
)

var mutex sync.Mutex
var num = 0
func test(){
	mutex.Lock()
	defer mutex.Unlock()
	num++
	fmt.Println("______test", num)
}

func main() {

	go func(){
		for i:=0; i<20; i++ {
			test()
		}
	}()
	test()
	time.Sleep(5*time.Second)
}